
//
//  OrderManagerViewController.m
//  BusinessApp
//
//  Created by macox on 16/10/14.
//  Copyright © 2016年 macox. All rights reserved.
//

#import "OrderManagerViewController.h"
#import "OrderManagerTableViewCell.h"
#import "OrderOperateStatusModel.h"
#import "OrderManagerModel.h"
#import "OrderDetailsViewController.h"
#import "ProductsModel.h"
@interface OrderManagerViewController ()<UITableViewDelegate,UITableViewDataSource,orderManagerDelegate>
@property (nonatomic , strong) UIView *sellV;
@property (nonatomic , strong) UIButton *AllNumBtn ;
@property (nonatomic , strong) UIButton *waiteGoogsButton;
@property (nonatomic , strong) UIButton *waitePayButton;
@property (nonatomic , strong) UIButton *moreButton;
@property (nonatomic , strong) UITableView *OrderManagerTableView;
@property (nonatomic , strong) NSMutableArray *OrderStateNumeberArr;
@property (nonatomic , strong) NSMutableArray *OrderListNumeberArr;
@property (nonatomic , assign) NSInteger pageNumber;
@property (nonatomic , strong) NSMutableArray *goodDataListRefresh;
@property (nonatomic , strong) UIView *moreView;
@property (nonatomic , strong) NSMutableArray *OrderListNumeberDetailArr;
@property (nonatomic , strong) UIImageView *NOImage ;
@property (nonatomic , assign) BOOL pageNo;;
@end

@implementation OrderManagerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"订单管理";
    _pageNumber = 1;
  
    self.view.backgroundColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.94 alpha:1.00];
    
    self.navigationController.tabBarController.tabBar.tintColor = [UIColor colorWithHue:0.23 saturation:0.65 brightness:0.71 alpha:1.00];
    _pageNo = YES;
    [self requestStateData];
    [self requestListData:@"0"];
    [self createUI];

}
#pragma mark -- 返回
- (void)classBackAction{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
  
   
}
- (void)createUI{
    _AllNumBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_AllNumBtn addTarget:self action:@selector(AllNumBtnAction) forControlEvents:UIControlEventTouchUpInside];
    _AllNumBtn.tag = 10000010;
    
    [_AllNumBtn setTitle:@"全部" forState:UIControlStateNormal];
    [_AllNumBtn setTitleColor:[UIColor colorWithRed:0.45 green:0.75 blue:0.19 alpha:1.00] forState:UIControlStateNormal];
    _AllNumBtn.frame = CGRectMake(0, 65, kScrernWidth / 4, 50);
    _AllNumBtn.titleLabel.font    = [UIFont systemFontOfSize: 13];
    _AllNumBtn.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_AllNumBtn];
    
    _waiteGoogsButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_waiteGoogsButton addTarget:self action:@selector(waiteGoogsButtonAction) forControlEvents:UIControlEventTouchUpInside];
    _waiteGoogsButton.tag = 10000011;
    //    OrderOperateStatusModel *model1 = _OrderStateNumeberArr[2];
    //    NSString *string1 = [NSString stringWithFormat:@"待发货(%@)",model1.OrderCount];
    [_waiteGoogsButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_waiteGoogsButton setTitle:@"待发货" forState:UIControlStateNormal];
    
    _waiteGoogsButton.frame = CGRectMake( (kScrernWidth / 4) +1, 65, (kScrernWidth / 4), 50);
    _waiteGoogsButton.titleLabel.font    = [UIFont systemFontOfSize: 13];
    _waiteGoogsButton.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_waiteGoogsButton];
    
    
    _waitePayButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_waitePayButton addTarget:self action:@selector(waitePayButtonAction) forControlEvents:UIControlEventTouchUpInside];
    [_waitePayButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    _waitePayButton.tag = 10000012;
    //    ProductSaleStatusModel *model2 = _goodDataStatusArr[1];
    //    NSString *string2 = [NSString stringWithFormat:@"审核中(%@)",model2.ProductCount];
    [_waitePayButton setTitle:@"待送达" forState:UIControlStateNormal];
    _waitePayButton.frame = CGRectMake( 2*(kScrernWidth / 4) +2, 65, (kScrernWidth / 4), 50);
    _waitePayButton.titleLabel.font    = [UIFont systemFontOfSize: 13];
    _waitePayButton.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_waitePayButton];
    
    
    
    _moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_moreButton addTarget:self action:@selector(moreButtonAction) forControlEvents:UIControlEventTouchUpInside];
    _moreButton.tag = 10000013;
    [_moreButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    //    ProductSaleStatusModel *model3 = _goodDataStatusArr[3];
    //    NSString *string3 = [NSString stringWithFormat:@"违规下架(%@)",model3.ProductCount];
    [_moreButton setTitle:@"更多" forState:UIControlStateNormal];
    _moreButton.frame = CGRectMake( 3*(kScrernWidth / 4) +3, 65, (kScrernWidth / 4) , 50);
    
    _moreButton.titleLabel.font    = [UIFont systemFontOfSize: 13];
    _moreButton.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_moreButton];
    
    
    _sellV = [[UIView alloc]initWithFrame:CGRectMake(0, 110, (kScrernWidth / 4), 5)];
    _sellV.backgroundColor = [UIColor colorWithRed:0.45 green:0.75 blue:0.21 alpha:1.00];
    [self.view addSubview:_sellV];
    
    
    _OrderManagerTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 117, kScrernWidth, kScrernHeight - 168) style:UITableViewStylePlain];
    _OrderManagerTableView.delegate = self;
    _OrderManagerTableView.dataSource = self;
    [_OrderManagerTableView  registerNib:[UINib nibWithNibName:@"OrderManagerTableViewCell" bundle:nil] forCellReuseIdentifier:@"OrdeerManagerCell"];
     _OrderManagerTableView.tableFooterView = [[UIView alloc] init];
    
    [self.view addSubview:_OrderManagerTableView];
}
- (void)AllNumBtnAction{
    
    //    _pageNumber = 1;
    //            [self requestListData];
    [self requestListData:@"0"];
    [_AllNumBtn setTitleColor:[UIColor colorWithRed:0.45 green:0.75 blue:0.19 alpha:1.00] forState:UIControlStateNormal];
    [_waiteGoogsButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    //    _numberl = 1;
    [_moreView removeFromSuperview];
    [_waitePayButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_moreButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    _sellV.frame = CGRectMake(_AllNumBtn.frame.origin.x, 110, (kScrernWidth / 4), 5);
    //    [_sellCenterTableV reloadData];
}
- (void)waiteGoogsButtonAction{
    //    _pageNumber = 1;
    [self requestListData:@"2"];
    [_moreView removeFromSuperview];
    [_AllNumBtn setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_waiteGoogsButton setTitleColor:[UIColor colorWithRed:0.45 green:0.75 blue:0.19 alpha:1.00] forState:UIControlStateNormal];
    [_waitePayButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_moreButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    //    _numberl = 2;
    
    _sellV.frame = CGRectMake(_waiteGoogsButton.frame.origin.x, 110, (kScrernWidth / 4), 5);
    //    [_sellCenterTableV reloadData];
}
- (void)requestStateData{
    [SVProgressHUD showWithStatus:@"正在加载"];
    _OrderStateNumeberArr = [NSMutableArray array];
    NSDictionary *param = @{@"ShouJiHao":GETPHONE,@"Duuid":GETUUID,@"Token":GETTOKEN,@"TodayOrAll":@"0"};
    [GDJHttpTool get:OrderType params:param success:^(id responseObj) {
        NSLog(@"%@", responseObj);
        NSLog(@"%@", param);
        if ([[responseObj objectForKey:@"Err"] intValue]) {
            
        }else{
            _OrderStateNumeberArr =   [OrderOperateStatusModel mj_objectArrayWithKeyValuesArray:[responseObj objectForKey:@"OrderOperateStatusModel"]];

        }
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
    }];
}
- (void)requestStateData01{
    [SVProgressHUD showWithStatus:@"正在加载"];
    _OrderStateNumeberArr = [NSMutableArray array];
    NSDictionary *param = @{@"ShouJiHao":GETPHONE,@"Duuid":GETUUID,@"Token":GETTOKEN,@"TodayOrAll":@"0"};
    [GDJHttpTool get:OrderType params:param success:^(id responseObj) {
        NSLog(@"%@", responseObj);
        NSLog(@"%@", param);
        if ([[responseObj objectForKey:@"Err"] intValue]) {
            
        }else{
            [SVProgressHUD dismiss];
            _OrderStateNumeberArr =   [OrderOperateStatusModel mj_objectArrayWithKeyValuesArray:[responseObj objectForKey:@"OrderOperateStatusModel"]];
        }
        OrderOperateStatusModel *model1 = _OrderStateNumeberArr[2];
        //        NSString *string1 = [NSString stringWithFormat:@"待发货(%@)",model1.OrderCount];
        //        [_waiteGoogsButton setTitle:string1 forState:UIControlStateNormal];
        //        [self createUI];
        
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
    }];
    
}
- (void)waitePayButtonAction{
    //    _pageNumber = 1;
    [self requestListData:@"3"];
    [_moreView removeFromSuperview];
    [_AllNumBtn setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_waiteGoogsButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_waitePayButton setTitleColor:[UIColor colorWithRed:0.45 green:0.75 blue:0.19 alpha:1.00] forState:UIControlStateNormal];
    [_moreButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    //    _numberl = 3;
    
    _sellV.frame = CGRectMake(_waitePayButton.frame.origin.x, 110, (kScrernWidth / 4), 5);
    //    [_sellCenterTableV reloadData];
    
    
    
    
}
- (void)moreButtonAction{
    //    _pageNumber = 1;
    //    [self requestListData:@"4"];
    [_AllNumBtn setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_waiteGoogsButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_waitePayButton setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    [_moreButton setTitleColor:[UIColor colorWithRed:0.45 green:0.75 blue:0.19 alpha:1.00] forState:UIControlStateNormal];
    //    _numberl = 4;
    
    _sellV.frame = CGRectMake(_moreButton.frame.origin.x, 108, (kScrernWidth / 4), 5);
    //    [_sellCenterTableV reloadData];
    _moreView = [[UIView alloc]initWithFrame:CGRectMake(_sellV.frame.origin.x - 2, _sellV.frame.origin.y + 4, (kScrernWidth / 4), 100)];
    _moreView.userInteractionEnabled = YES;
    _moreView.layer.borderWidth = 0.5;
    _moreView.layer.borderColor = [[UIColor grayColor] CGColor];
    _moreView.backgroundColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.94 alpha:1.00];
    [self.view addSubview:_moreView];
    
    
    
    
    //    UIButton  *ShippedBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    //    [ShippedBtn addTarget:self action:@selector(ShippedBtnAction) forControlEvents:UIControlEventTouchUpInside];
    //    //    _waitePayButton.tag = 10000012;
    //    //    ProductSaleStatusModel *model2 = _goodDataStatusArr[1];
    //    //    NSString *string2 = [NSString stringWithFormat:@"审核中(%@)",model2.ProductCount];
    //    [ShippedBtn setTitle:@"待送达" forState:UIControlStateNormal];
    //    [ShippedBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    //    [ShippedBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    //    ShippedBtn.frame = CGRectMake(0, 0, (kScrernWidth / 4), 50);
    //    ShippedBtn.titleLabel.font    = [UIFont systemFontOfSize: 13];
    //    ShippedBtn.backgroundColor = [UIColor whiteColor];
    //    [_moreView addSubview:ShippedBtn];
    
    
    
    
    UIButton  *completeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [completeBtn addTarget:self action:@selector(completeBtnAction) forControlEvents:UIControlEventTouchUpInside];
    //    _waitePayButton.tag = 10000012;
    //    ProductSaleStatusModel *model2 = _goodDataStatusArr[1];
    //    NSString *string2 = [NSString stringWithFormat:@"审核中(%@)",model2.ProductCount];
    [completeBtn setTitle:@"已完成" forState:UIControlStateNormal];
    //    [completeBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [completeBtn setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00]forState:UIControlStateNormal];
    completeBtn.frame =  CGRectMake(0, 0, (kScrernWidth / 4), 50);
    
    completeBtn.titleLabel.font    = [UIFont systemFontOfSize: 13];
    completeBtn.backgroundColor = [UIColor whiteColor];
    [_moreView addSubview:completeBtn];
    
    
    
    UIButton  *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [closeBtn addTarget:self action:@selector(closeBtnAction) forControlEvents:UIControlEventTouchUpInside];
    //    _waitePayButton.tag = 10000012;
    //    ProductSaleStatusModel *model2 = _goodDataStatusArr[1];
    //    NSString *string2 = [NSString stringWithFormat:@"审核中(%@)",model2.ProductCount];
    [closeBtn setTitle:@"已关闭" forState:UIControlStateNormal];
    //    [closeBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [closeBtn setTitleColor:[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] forState:UIControlStateNormal];
    closeBtn.frame =  CGRectMake(0, 51, (kScrernWidth / 4), 50);
    closeBtn.titleLabel.font    = [UIFont systemFontOfSize: 13];
    closeBtn.backgroundColor = [UIColor whiteColor];
    [_moreView addSubview:closeBtn];
    
    
    
    
}
#pragma mark -- 已发货
- (void)ShippedBtnAction{
    NSLog(@"已发货");
    [self requestListData:@"3"];
    [_moreView removeFromSuperview];
}
#pragma mark -- 已完成
- (void)completeBtnAction{
    NSLog(@"已完成");
    [self requestListData:@"5"];
    [_moreView removeFromSuperview];
}
#pragma mark -- 已关闭
- (void)closeBtnAction{
    NSLog(@"已关闭");
    [self requestListData:@"4"];
    [_moreView removeFromSuperview];
}
- (void)requestListData:(NSString *)intNumber{
    [SVProgressHUD showWithStatus:@"正在加载"];
    _OrderListNumeberDetailArr = [NSMutableArray array];
    _OrderListNumeberArr = [NSMutableArray array];
    NSDictionary *param = @{@"ShouJiHao":GETPHONE,@"Duuid":GETUUID,@"Token":GETTOKEN,@"Statues":intNumber,@"Index":@"1",@"MaxId":@"0", @"TodayOrAll":@"0"};
    NSLog(@"%@", param);
    [GDJHttpTool get:OrderList111 params:param success:^(id responseObj) {
        NSLog(@"======%@", responseObj);
        NSLog(@"%@", param);
        [SVProgressHUD dismiss];
        if ([[responseObj objectForKey:@"Err"] intValue]) {
            
        }else{
            
            _OrderListNumeberArr =   [OrderManagerModel mj_objectArrayWithKeyValuesArray:[responseObj objectForKey:@"Orders"]];
            
            NSArray *Orders = responseObj[@"Orders"];
            for (  NSDictionary *OrderDic in Orders) {
                NSDictionary *products = OrderDic[@"Products"][0]; //你要的
                [_OrderListNumeberDetailArr addObject:products];
            }
            
            
        }
        
        if(_OrderListNumeberArr.count == 0){
            if (_pageNo == YES) {
                  _NOImage = [[UIImageView alloc]initWithFrame:CGRectMake(0 , 115, self.view.frame.size.width, self.view.frame.size.height - 70)];
                _NOImage.image = [UIImage imageNamed:@"暂时没有此类订单"];
                [self.view addSubview:_NOImage];
                _pageNo = NO;
            }else{
                
            }
            


        }
        if (_OrderListNumeberArr.count != 0) {
            [_NOImage removeFromSuperview];
            _pageNo = YES;
            NSLog(@"黄瑞安%ld",(long)_pageNo);
            OrderManagerModel * OrderManagerModel = _OrderListNumeberArr[0];
            [_OrderManagerTableView reloadData];
            
            NSLog(@"zuida%@", OrderManagerModel.Id);
            [self example21:OrderManagerModel.Id:intNumber];
        }
        NSLog(@"______________%lu",(unsigned long)_OrderListNumeberArr.count);
        [_OrderManagerTableView setContentOffset:CGPointMake(0,0) animated:NO];
        [_OrderManagerTableView reloadData];
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
    }];
    
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 151;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _OrderListNumeberArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    OrderManagerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrdeerManagerCell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    if (_OrderListNumeberArr.count != 0) {
        OrderManagerModel *Mymodel = _OrderListNumeberArr[indexPath.row];
        cell.model = Mymodel;
        cell.delegate = self;
    }
    
    
    return cell;
}
#pragma mark -- 刷新加载数据
- (void)example21:(NSString *)MaID:(NSString *)intNumber{
    __unsafe_unretained __typeof(self) weakSelf = self;
    NSLog(@"查询");
    //        weakSelf.storeListTableView.mj_header.hidden = NO;
    // 下拉刷新
    weakSelf.OrderManagerTableView.mj_header= [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        
        //        pageNumber = 1;
        //        [self requestDataNewRefresh:@"1" :MaID];
        
        
        //        [weakSelf.OrderManagerTableView reloadData];
        // 结束刷新
        [weakSelf.OrderManagerTableView.mj_header endRefreshing];
        
    }];
    //    [weakSelf.sellCenterTableV.mj_header beginRefreshing];
    // 上拉刷新
    weakSelf.OrderManagerTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
        
        _pageNumber ++;
        [self requestDataListRefresh:intNumber :[NSString stringWithFormat:@"%ld", (long)_pageNumber ] :MaID];
        
        //        [weakSelf.OrderManagerTableView reloadData];
        // 结束刷新
        [weakSelf.OrderManagerTableView.mj_footer endRefreshing];
        
    }];
    // 默认先隐藏footer
    weakSelf.OrderManagerTableView.mj_footer.hidden = NO;
}
//#pragma mark -- 加载更多数据
- (void)requestDataListRefresh:(NSString *)Statues:(NSString *)Index:(NSString *)MaxId{
    [SVProgressHUD showWithStatus:@"正在加载"];
    _goodDataListRefresh = [NSMutableArray array];
    NSDictionary *param = @{@"ShouJiHao":GETPHONE,@"Duuid":GETUUID,@"Token":GETTOKEN,@"Statues":Statues,@"Index":Index,@"MaxId":MaxId, @"TodayOrAll":@"0"};
    
    NSLog(@"******%lu",(unsigned long)_OrderListNumeberArr.count);
    
    
    [GDJHttpTool get:OrderList111 params:param success:^(id responseObj) {
        NSLog(@"+++++++++________%@", responseObj);
        NSLog(@"eqwe%@", param);
        if ([[responseObj objectForKey:@"Err"] intValue]) {
            
        }else{
            
            [SVProgressHUD dismiss];
            _goodDataListRefresh =   [OrderManagerModel mj_objectArrayWithKeyValuesArray:[responseObj objectForKey:@"Orders"]];
            if (_OrderListNumeberArr.count != 0) {
                [_OrderListNumeberArr addObjectsFromArray:_goodDataListRefresh];
                NSLog(@"&&&&&&&&&&&&***********%lu",(unsigned long)_OrderListNumeberArr.count);
                
                NSArray *Orders = responseObj[@"Orders"];
                for (  NSDictionary *OrderDic in Orders) {
                    NSDictionary *products = OrderDic[@"Products"][0]; //你要的
                    [_OrderListNumeberDetailArr addObject:products];
                }
                NSLog(@"=====---------%lu",(unsigned long)_OrderListNumeberDetailArr.count);
            }
            
        }
        
        
        [_OrderManagerTableView reloadData];
        
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
    }];
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"选择某一行");
    
    OrderDetailsViewController *order = [[OrderDetailsViewController alloc]init];
    if (_OrderListNumeberArr.count != 0) {
        OrderManagerModel *Mymodel = _OrderListNumeberArr[indexPath.row];
        NSMutableDictionary *dic = _OrderListNumeberDetailArr [indexPath.row];
        NSLog(@"+++++++++++%@", dic);
        order.ProID = Mymodel.Id;
        self.hidesBottomBarWhenPushed=YES;
        [self.navigationController pushViewController:order animated:YES];
        self.hidesBottomBarWhenPushed=NO;
    }
    
}
#pragma  mark -- 更多状态
- (void)orderManagerTrun:(NSString *)proID :(NSString *)state{
    [SVProgressHUD showWithStatus:@"正在加载"];
    NSDictionary *param = @{@"ShouJiHao":GETPHONE,@"Duuid":GETUUID,@"Token":GETTOKEN,@"OrderId":proID};
    NSString * string  = nil;
    
    if ([state isEqualToString:@"待发货"]) {
        string = DoShipping;
    }else{
        string =  DoFinish;
    }
    [GDJHttpTool post:string params:param success:^(id responseObj) {
        NSLog(@"%3000200302003@", responseObj);
        NSLog(@"%@", param);
        if ([[responseObj objectForKey:@"Err"] intValue]) {
            
        }else{
            [SVProgressHUD dismiss];
            //            if( [[responseObj objectForKey:@"ErrMsg"] isEqualToString:@"发货成功"]){
            [self requestListData:@"2"];
            [self waiteGoogsButtonAction];
            //            }
            
            
        }
        [_OrderManagerTableView reloadData];
    } failure:^(NSError *error) {
        
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
